<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>tab栏</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        li {
            list-style: none;
        }
        
        .tab {
            width: 988px;
            margin: 0 auto;
        }
        
        .tab_list {
            height: 36px;
            text-align: center;
            line-height: 36px;
            font-size: 14px;
            border-bottom: #e4393c 1px solid;
            /* border: 1px solid #ccc; */
            background-color: #ccc;
            cursor: pointer;
        }
        
        .tab_list li {
            float: left;
            display: block;
            width: 150px;
            height: 36px;
        }
        
        .tab_col_space {
            width: 30px;
            height: 36px;
        }
        
        .item {
            display: none;
        }
        
        .current_list {
            background-color: #e4393c;
        }
    </style>
</head>

<body>
    <!-- tab栏 -->
    <div class="tab">
        <!-- tab列表 -->
        <div class="tab_list">
            <ul>
                <li class="current_list">商品介绍</li>
                <li>规格与包装</li>
                <li>售后保障</li>
                <li>商品评价(190万+)</li>
                <li>商品问答</li>
            </ul>
        </div>
        <!-- 列表内容 -->
        <div class="tab_content">
            <div class="item" style="display: block;">
                商品介绍内容
            </div>
            <div class="item">
                规格与包装内容
            </div>
            <div class="item">
                售后保障内容
            </div>
            <div class="item">
                商品评价(190万+)内容
            </div>
            <div class="item">
                商品问答内容
            </div>
        </div>
    </div>
</body>

</html>
<script>
    let tab_list = window.document.querySelector('.tab_list');
    let lis = window.document.querySelectorAll('li');
    let items = window.document.querySelectorAll('.item');
    for (let i = 0; i < lis.length; i++) {
        const element = lis[i];
        element.onclick = function(param) {
            for (let j = 0; j < lis.length; j++) {
                let className = lis[j].className;
                if ('current_list' == className) {
                    lis[j].className = '';
                }
                items[j].style.display = 'none';
            }
            element.className = 'current_list';
            items[i].style.display = 'block';
        };
    }
</script>